//
//  LTConversationCacheSQL.h
//  LTIM
//
//  Created by 俊松何 on 2017/3/30.
//  Copyright © 2017年 俊松何. All rights reserved.
//

#ifndef LTConversationCacheSQL_h
#define LTConversationCacheSQL_h

#define  TOTALCOUNT                    @"totalcount"


#define  LT_TABLE_VERSION_INFO          @"t_versionInfo"


#define  LongLinkIP                     @"longlinkIp"
#define  LongLinkPort                   @"longLinkPort"

//创建版本信息表
#define LT_SQL_CREATE_VERSION_INFO_TABLE \
@"CREATE TABLE IF NOT EXISTS " LT_TABLE_VERSION_INFO @" ("   \
LongLinkIP                     @" TEXT, "            \
LongLinkPort                   @" TEXT "            \
@")"

//获取版本信息
#define LT_SQL_SELECT_VERSION_INFO      \
@"SELECT * FROM " LT_TABLE_VERSION_INFO 

//删除版本信息
#define LT_SQL_DELETE_VERSION_INFO    \
@"DELETE  FROM  " LT_TABLE_VERSION_INFO  @" " \
@"WHERE 1 = 1 "

//保存版本信息
#define LT_SQL_INSERT_VERSION_INFO   \
@"INSERT OR REPLACE INTO " LT_TABLE_VERSION_INFO   @" ("      \
LongLinkIP                                         @", "      \
LongLinkPort                                                  \
@") VALUES(?, ?)"


#define LT_TABLE_CONVERSATION          @"t_conversation"

#define LT_CONVERSATION_Id             @"conversationId"
#define LT_CONVERSATION_User           @"conversationUser"
#define LT_CONVERSATION_isTop          @"isTop"
#define LT_CONVERSATION_isSilent       @"isSilent"
#define LT_CONVERSATION_digest         @"digest"
#define LT_CONVERSATION_digestUser     @"digestUser"
#define LT_CONVERSATION_editingMsg     @"editingMsg"
#define LT_CONVERSATION_extra          @"extra"
#define LT_CONVERSATION_lastMsgTime    @"lastMsgTime"
#define LT_CONVERSATION_chatMode       @"chatMode"


//创建Conversation表
#define LT_SQL_CREATE_CONVERSATION_TABLE \
@"CREATE TABLE IF NOT EXISTS " LT_TABLE_CONVERSATION @" ("   \
LT_CONVERSATION_Id                     @" TEXT, "            \
LT_CONVERSATION_User                   @" TEXT, "            \
LT_CONVERSATION_isTop                  @" INTEGER, "         \
LT_CONVERSATION_isSilent               @" INTEGER, "         \
LT_CONVERSATION_digest                 @" TEXT, "            \
LT_CONVERSATION_digestUser             @" TEXT, "            \
LT_CONVERSATION_editingMsg             @" TEXT, "            \
LT_CONVERSATION_extra                  @" TEXT, "            \
LT_CONVERSATION_lastMsgTime            @" TEXT, "            \
LT_CONVERSATION_chatMode               @" INTEGER, "         \
@"PRIMARY KEY(" LT_CONVERSATION_Id @")"                      \
@")"

//插入一条会话信息
#define LT_SQL_INSERT_CONVERSATION                           \
@"INSERT OR REPLACE INTO " LT_TABLE_CONVERSATION  @" ("      \
LT_CONVERSATION_Id                    @", "                  \
LT_CONVERSATION_User                  @", "                  \
LT_CONVERSATION_isTop                 @", "                  \
LT_CONVERSATION_isSilent              @", "                  \
LT_CONVERSATION_digest                @", "                  \
LT_CONVERSATION_digestUser            @", "                  \
LT_CONVERSATION_editingMsg            @", "                  \
LT_CONVERSATION_extra                 @", "                  \
LT_CONVERSATION_lastMsgTime           @", "                  \
LT_CONVERSATION_chatMode                                     \
@") VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"


//删除指定会话id的会话
#define LT_SQL_DELETE_CONVERSATION              \
@"DELETE FROM " LT_TABLE_CONVERSATION @" "  \
@"WHERE " LT_CONVERSATION_Id @" = ?"

//查询指定会话id的会话
#define LT_SQL_SELECT_CONVERSATION_Id                \
@"SELECT * FROM " LT_TABLE_CONVERSATION @" "  \
@"WHERE " LT_CONVERSATION_Id @" = ?"


//查询所有会话
#define LT_SQL_ALL_CONVERSATION                \
@"SELECT * FROM " LT_TABLE_CONVERSATION

//删除指定会话id的会话
#define LT_SQL_DELETE_CONVERSATION_Id                \
@"SELECT * FROM " LT_TABLE_CONVERSATION @" "        \
@"WHERE " LT_CONVERSATION_Id @" = ?"

//设置会话置顶与否
#define LT_SQL_SET_ISTOP_CONVERSATION_Id     \
@"UPDATE " LT_TABLE_CONVERSATION @" "        \
@"SET " LT_CONVERSATION_isTop @" = ?" @" "   \
@"WHERE " LT_CONVERSATION_Id @" = ?"

//设置会话是否免打扰
#define LT_SQL_SET_ISSILENT_CONVERSATION_Id     \
@"UPDATE " LT_TABLE_CONVERSATION @" "        \
@"SET " LT_CONVERSATION_isSilent @" = ?" @" "   \
@"WHERE " LT_CONVERSATION_Id @" = ?"


//--------------------------  Message  ---------------------------//

#define LT_TABLE_MESSAGE                @"t_message"
#define LT_MESSAGE_messageId            @"messageId"
#define LT_MESSAGE_conversationId       @"conversationId"
#define LT_MESSAGE_fromUserId           @"fromUserId"
#define LT_MESSAGE_tagetUserId          @"tagetUserId"
#define LT_MESSAGE_since                @"since"
#define LT_MESSAGE_target               @"target"
#define LT_MESSAGE_content              @"content"
#define LT_MESSAGE_direction            @"direction"
#define LT_MESSAGE_type                 @"type"
#define LT_MESSAGE_chatMode             @"chatMode"
#define LT_MESSAGE_status               @"status"
#define LT_MESSAGE_transContent         @"transContent"
#define LT_MESSAGE_extra                @"extra"
#define LT_MESSAGE_cellType             @"cellType"
#define LT_MESSAGE_serverTime           @"serverTime"
#define LT_MESSAGE_createTime           @"createTime"
#define LT_MESSAGE_isRead               @"isRead"

//#define LT

//创MESSAGE建表
#define LT_SQL_CREATE_MESSAGE_TABLE \
@"CREATE TABLE IF NOT EXISTS " LT_TABLE_MESSAGE @" ("         \
LT_MESSAGE_messageId                    @" TEXT, "             \
LT_MESSAGE_conversationId               @" TEXT, "            \
LT_MESSAGE_fromUserId                   @" TEXT, "            \
LT_MESSAGE_tagetUserId                  @" TEXT, "            \
LT_MESSAGE_since                        @" TEXT, "            \
LT_MESSAGE_target                       @" TEXT, "            \
LT_MESSAGE_content                      @" TEXT, "            \
LT_MESSAGE_direction                    @" INTEGER, "         \
LT_MESSAGE_type                         @" INTEGER, "         \
LT_MESSAGE_chatMode                     @" INTEGER, "         \
LT_MESSAGE_status                       @" INTEGER, "         \
LT_MESSAGE_transContent                 @" TEXT, "            \
LT_MESSAGE_extra                        @" TEXT, "            \
LT_MESSAGE_cellType                     @" INTEGER, "         \
LT_MESSAGE_serverTime                   @" BIGINT, "           \
LT_MESSAGE_createTime                   @" BIGINT, "           \
LT_MESSAGE_isRead                       @" INTEGER, "          \
@"PRIMARY KEY(" LT_MESSAGE_messageId @")"                     \
@")"

//插入一MESSAGE条数据
#define LT_SQL_INSERT_MESSAGE                          \
@"INSERT OR REPLACE INTO " LT_TABLE_MESSAGE @" ("      \
LT_MESSAGE_messageId                        @", "      \
LT_MESSAGE_conversationId                   @", "      \
LT_MESSAGE_fromUserId                       @", "      \
LT_MESSAGE_tagetUserId                      @", "      \
LT_MESSAGE_since                            @", "      \
LT_MESSAGE_target                           @", "      \
LT_MESSAGE_content                          @", "      \
LT_MESSAGE_direction                        @", "      \
LT_MESSAGE_type                             @", "      \
LT_MESSAGE_chatMode                         @", "      \
LT_MESSAGE_status                           @", "      \
LT_MESSAGE_transContent                     @", "      \
LT_MESSAGE_extra                            @", "      \
LT_MESSAGE_cellType                         @", "      \
LT_MESSAGE_serverTime                       @", "      \
LT_MESSAGE_createTime                       @", "      \
LT_MESSAGE_isRead                                      \
@") VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"


//查询指定会话id的所有消息
#define LT_SQL_SELECT_MESSAGE_WITH_MESSAGEID     \
@"SELECT * FROM " LT_TABLE_MESSAGE @" "  \
@"WHERE " LT_MESSAGE_messageId @" = ? "    \


//查询指定会话id的所有消息
#define LT_SQL_SELECT_MESSAGE_WITH_CONVERSATION     \
@"SELECT * FROM " LT_TABLE_MESSAGE @" "  \
@"WHERE " LT_MESSAGE_conversationId @" = ? "    \
@"ORDER BY " LT_MESSAGE_createTime @" ASC "

//查询指定回话id的所欲At未读消息
#define LT_SQL_SELECT_UNREADATMESSAGE_WITH_CONVERSATION     \
@"SELECT * FROM " LT_TABLE_MESSAGE @" "  \
@"WHERE " LT_MESSAGE_conversationId @" = ? AND " LT_MESSAGE_isRead @" = 0 AND " LT_MESSAGE_type @" = 1018"


#define LT_SQL_SELECT_MESSAGE_WITH_CONVERSATION_PAGE  \
@"SELECT * FROM ( "   \
@"SELECT * FROM " LT_TABLE_MESSAGE  @" "\
@"WHERE " LT_MESSAGE_conversationId @" = ? AND " LT_MESSAGE_createTime @" < ? " \
@"ORDER BY " LT_MESSAGE_createTime @" DESC LIMIT ? ) "     \
@"ORDER BY " LT_MESSAGE_createTime @" ASC "




//删除指定会话id的所有消息
#define LT_SQL_DELETE_MESSAGE_WITH_CONVERSATION_ID \
@"DELETE  FROM " LT_TABLE_MESSAGE @" "        \
@"WHERE " LT_MESSAGE_conversationId @" = ?"

//删除指定消息id的一条消息消息
#define LT_SQL_DELETE_MESSAGE_WITH_MESSAGE_ID \
@"DELETE  FROM " LT_TABLE_MESSAGE @" "        \
@"WHERE " LT_MESSAGE_messageId @" = ?"


//会话下的所有消息标记为已读
#define LT_SQL_UPDATE_ISREAD_MESSAGE_WITH_CONVERSATION_ID  \
@"UPDATE " LT_TABLE_MESSAGE @" SET " LT_MESSAGE_isRead @" = 1 "   \
@"WHERE "  LT_MESSAGE_conversationId @" = ? " \
@"AND "    LT_MESSAGE_isRead @" = 0"
//更新一条消息为已读
#define LT_SQL_UPDATE_ISREAD_MESSAGE_WITH_MESSAGE_ID         \
@"UPDATE " LT_TABLE_MESSAGE @" SET " LT_MESSAGE_isRead @" = 1 "   \
@"WHERE " LT_MESSAGE_messageId @" = ? " \

//查询指定会话id的未读消息数
#define LT_SQL_SELECT_MESSAGECOUNT_WITH_CONVERSATION_ID  \
@"SELECT count(*) as " TOTALCOUNT  @" FROM " LT_TABLE_MESSAGE @" "        \
@"WHERE " LT_MESSAGE_conversationId @" = ? AND " LT_MESSAGE_isRead @" = 0 "

//查询指定会话id的未读消息数
#define LT_SQL_SELECT_ATMESSAGECOUNT_WITH_CONVERSATION_ID  \
@"SELECT count(*) as " TOTALCOUNT  @" FROM " LT_TABLE_MESSAGE @" "        \
@"WHERE " LT_MESSAGE_conversationId @" = ? AND " LT_MESSAGE_isRead @" = 0 AND " LT_MESSAGE_type @" = 1018"

//查询所有的未读消息
#define LT_SQL_SELECT_MESSAGECOUNT_WITH_ALL  \
@"SELECT count(*) as " TOTALCOUNT  @" FROM " LT_TABLE_MESSAGE @" "    \
@"WHERE "  LT_MESSAGE_isRead @" = 0 "



/*--------------------------- USER ---------------------------**/

#define LT_TABLE_USER              @"t_user"

#define LT_USER_userId             @"userId"
#define LT_USER_name               @"name"
#define LT_USER_avatar             @"avatar"
#define LT_USER_remark             @"remark"
#define LT_USER_namePy             @"namePy"
#define LT_USER_remarkPy           @"remarkPy"
#define LT_USER_type               @"type"
#define LT_USER_phone              @"phone"
#define LT_USER_extra              @"extra"
#define LT_USER_account            @"account"


//创建表
#define LT_SQL_CREATE_USER_TABLE                        \
@"CREATE TABLE IF NOT EXISTS " LT_TABLE_USER @" ("      \
LT_USER_userId           @" TEXT, "            \
LT_USER_name             @" INTEGER, "         \
LT_USER_avatar           @" INTEGER, "         \
LT_USER_remark           @" TEXT, "            \
LT_USER_namePy           @" TEXT, "            \
LT_USER_remarkPy         @" TEXT, "            \
LT_USER_type             @" INTEGER, "         \
LT_USER_phone            @" TEXT, "            \
LT_USER_extra            @" TEXT, "            \
LT_USER_account          @" TEXT, "            \
@"PRIMARY KEY(" LT_USER_userId @")"            \
@")"

//插入一USER条数据
#define LT_SQL_INSERT_USER                       \
@"INSERT OR REPLACE INTO " LT_TABLE_USER @" ("   \
        LT_USER_userId          @", "            \
        LT_USER_name            @", "            \
        LT_USER_avatar          @", "            \
        LT_USER_remark          @", "            \
        LT_USER_namePy          @", "            \
        LT_USER_remarkPy        @", "            \
        LT_USER_type            @", "            \
        LT_USER_phone           @", "            \
        LT_USER_extra           @", "            \
        LT_USER_account                          \
        @") VALUES (?,?,?,?,?,?,?,?,?,?)"

//获取所有USER
#define LT_SQL_SELECT_USER_FRIEND          \
@"SELECT * FROM " LT_TABLE_USER

//获取关键词USER
#define LT_SQL_SELECT_USER_FRIEND_KEYWORLD          \
@"SELECT * FROM " LT_TABLE_USER @" "  \
@"WHERE "  LT_USER_name @" LIKE ? "


//获取单个用户
#define LT_SQL_SELECT_USER_USERID          \
@"SELECT * FROM " LT_TABLE_USER @" "      \
@"WHERE "  LT_USER_userId @" = ? "

//删除指定userId的用户
#define LT_SQL_DELETE_WITH_USERID          \
@"DELETE  FROM " LT_TABLE_USER @" "      \
@"WHERE "  LT_USER_userId @" = ? "

//清空所有用户
#define LT_SQL_DELETE_ALLUSER          \
@"DELETE FROM " LT_TABLE_USER

//通过userID查询是否是好友
#define LT_SQL_CHECKFRIEND_USERID   \
@"SELECT count(*) as " TOTALCOUNT  @" FROM " LT_TABLE_USER @" "    \
@"WHERE "  LT_USER_userId @" = ? "


/*--------------------------- Group ---------------------------**/
#define LT_TABLE_GROUP             @"t_group"
#define LT_TABLE_MYGROUP           @"t_mygroup"


#define LT_GROUP_id                 @"id"
#define LT_GROUP_createDate         @"createDate"
#define LT_GROUP_avatar             @"avatar"
#define LT_GROUP_name               @"name"
#define LT_GROUP_ownerId            @"ownerId"
#define LT_GROUP_users              @"users"
#define LT_GROUP_qrCode             @"qrCode"

//创建Group表
#define LT_SQL_CREATE_GROUP_TABLE                     \
@"CREATE TABLE IF NOT EXISTS " LT_TABLE_GROUP @" ("   \
LT_GROUP_id                     @" TEXT, "            \
LT_GROUP_createDate             @" TEXT, "         \
LT_GROUP_avatar                 @" TEXT, "         \
LT_GROUP_name                   @" TEXT, "            \
LT_GROUP_ownerId                @" TEXT, "            \
LT_GROUP_users                  @" TEXT, "            \
LT_GROUP_qrCode                 @" TEXT, "            \
@"PRIMARY KEY(" LT_GROUP_id @")"                      \
@")"

//获取所有GROUP
#define LT_SQL_SELECT_ALL_GROUP          \
@"SELECT * FROM " LT_TABLE_GROUP

//搜索获取我保存的所有GROUP
#define LT_SQL_SELECT_ALL_GROUPKEYWORLD          \
@"SELECT * FROM " LT_TABLE_GROUP @" "  \
@"WHERE "  LT_GROUP_name @" LIKE ? "

//删除指定GroupID的群租
#define LT_SQL_DELETE_WITH_GROUPID          \
@"DELETE  FROM " LT_TABLE_GROUP @" "         \
@"WHERE "  LT_GROUP_id @" = ? "

//查询指定群ID的群组
#define LT_SQL_SELECT_GROUP_id                \
@"SELECT * FROM " LT_TABLE_GROUP @" "  \
@"WHERE " LT_GROUP_id @" = ?"

//插入一条Group数据
#define LT_SQL_INSERT_GROUP                        \
@"INSERT OR REPLACE INTO " LT_TABLE_GROUP @" ("    \
LT_GROUP_id                               @", "    \
LT_GROUP_createDate                       @", "    \
LT_GROUP_avatar                           @", "    \
LT_GROUP_name                             @", "    \
LT_GROUP_ownerId                          @", "    \
LT_GROUP_users                            @", "    \
LT_GROUP_qrCode                                    \
@") VALUES (?,?,?,?,?,?,?)"



//创建我自己的Group表
#define LT_SQL_CREATE_MYGROUP_TABLE                     \
@"CREATE TABLE IF NOT EXISTS " LT_TABLE_MYGROUP @" ("   \
LT_GROUP_id                     @" TEXT, "            \
LT_GROUP_createDate             @" TEXT, "         \
LT_GROUP_avatar                 @" TEXT, "         \
LT_GROUP_name                   @" TEXT, "            \
LT_GROUP_ownerId                @" TEXT, "            \
LT_GROUP_users                  @" TEXT, "            \
LT_GROUP_qrCode                 @" TEXT, "            \
@"PRIMARY KEY(" LT_GROUP_id @")"                      \
@")"

//获取我保存的所有GROUP
#define LT_SQL_SELECT_ALL_MYGROUP          \
@"SELECT * FROM " LT_TABLE_MYGROUP



//删除指定GroupID的群租
#define LT_SQL_DELETE_WITH_MYGROUPID          \
@"DELETE  FROM " LT_TABLE_MYGROUP @" "         \
@"WHERE "  LT_GROUP_id @" = ? "

//清空我所有的群组用户
#define LT_SQL_DELETE_MYALLGROUP          \
@"DELETE FROM " LT_TABLE_MYGROUP

//查询指定群ID的群组
#define LT_SQL_SELECT_MYGROUP_id                \
@"SELECT * FROM " LT_TABLE_MYGROUP @" "  \
@"WHERE " LT_GROUP_id @" = ?"

//插入一条Group数据
#define LT_SQL_INSERT_MYGROUP                      \
@"INSERT OR REPLACE INTO " LT_TABLE_MYGROUP @" ("  \
LT_GROUP_id                               @", "    \
LT_GROUP_createDate                       @", "    \
LT_GROUP_avatar                           @", "    \
LT_GROUP_name                             @", "    \
LT_GROUP_ownerId                          @", "    \
LT_GROUP_users                            @", "    \
LT_GROUP_qrCode                                    \
@") VALUES (?,?,?,?,?,?,?)"


/*--------------------------- applyMessage ---------------------------**/

#define LT_TABLE_APPLY             @"t_apply"

#define LT_APPLY_applyMessageId    @"applyMessageId"
#define LT_APPLY_since             @"since"
#define LT_APPLY_target            @"target"
#define LT_APPLY_sinceUserId       @"sinceUserId"
#define LT_APPLY_targetUserId      @"targetUserId"
#define LT_APPLY_reason            @"reason"
#define LT_APPLY_status            @"status"
#define LT_APPLY_isRead            @"isRead"
#define LT_APPLY_type              @"type"
#define LT_APPLY_createTime        @"createTime"

//创建表
#define LT_SQL_CREATE_APPLY_TABLE                      \
@"CREATE TABLE IF NOT EXISTS " LT_TABLE_APPLY @" ("    \
LT_APPLY_applyMessageId                  @" TEXT, "         \
LT_APPLY_since                           @" TEXT, "         \
LT_APPLY_target                          @" TEXT, "         \
LT_APPLY_sinceUserId                     @" TEXT, "         \
LT_APPLY_targetUserId                    @" TEXT, "         \
LT_APPLY_reason                          @" TEXT, "         \
LT_APPLY_status                          @" INTEGER, "      \
LT_APPLY_isRead                          @" INTEGER, "      \
LT_APPLY_type                            @" INTEGER, "      \
LT_APPLY_createTime                      @" INTEGER, "      \
@"PRIMARY KEY(" LT_APPLY_applyMessageId @")"                \
@")"



//插入一条APPLY数据
#define LT_SQL_INSERT_APPLY                     \
@"INSERT OR REPLACE INTO " LT_TABLE_APPLY @" ("  \
LT_APPLY_applyMessageId           @", "            \
LT_APPLY_since                    @", "            \
LT_APPLY_target                   @", "            \
LT_APPLY_sinceUserId              @", "            \
LT_APPLY_targetUserId             @", "            \
LT_APPLY_reason                   @", "            \
LT_APPLY_status                   @", "            \
LT_APPLY_isRead                   @", "            \
LT_APPLY_type                     @", "            \
LT_APPLY_createTime               \
@") VALUES (?,?,?,?,?,?,?,?,?,?)"

//删除一条APPLY数据
#define  LT_SQL_DELETE_APPLTY_MESSAGEID   \
@"DELETE  FROM " LT_TABLE_APPLY @" "      \
@"WHERE "  LT_APPLY_applyMessageId @" = ? "

//通过sinceUserId删除一条APPLY数据
#define  LT_SQL_DELETE_APPLTY_MESSAGEID_SINCE   \
@"DELETE  FROM " LT_TABLE_APPLY @" "      \
@"WHERE "  LT_APPLY_sinceUserId @" = ? "

//获取所有apply
#define LT_SQL_SELECT_APPLY          \
@"SELECT * FROM " LT_TABLE_APPLY    @" " \
@"ORDER BY " LT_APPLY_createTime @" DESC "

//查询所有的未读申请消息数   .....
#define LT_SQL_SELECT_APPLYMEMESSAGE_COUNT  \
@"SELECT count(*) as " TOTALCOUNT  @" FROM " LT_TABLE_APPLY @" "    \
@"WHERE "  LT_APPLY_isRead @" = 0 "


//更新所有申请消息为已读
#define LT_SQL_UPDATE_ISREAD_APPLYMESSAGE                       \
@"UPDATE " LT_TABLE_APPLY @" SET " LT_APPLY_isRead @" = 1 "   \


/*--------------------------- NoticeMessage 通知消息小红点---------------------------**/
#define LT_TABLE_NoticeMessage             @"t_notice_message"

#define LT_NoticeMessage_id             @" id "
#define LT_NoticeMessage_type           @" type "


//创建表
#define LT_SQL_CREATE_NotceMessage_TABLE            \
@"CREATE TABLE IF NOT EXISTS " LT_TABLE_NoticeMessage @" ("    \
LT_NoticeMessage_id                        @" INTEGER, "       \
LT_NoticeMessage_type                      @" INTEGER, "       \
@"PRIMARY KEY AUTOINCREMENT(" LT_APPLY_applyMessageId @")"                \
@")"

//插入一条数据
#define LT_SQL_INSERT_NotceMessage    \
@"INSERT OR REPLACE INTO " LT_TABLE_NoticeMessage @" ("  \
LT_NoticeMessage_type                      @" , "       \
@") VALUES (?)"

//删除指定类型的消息
#define LT_SQL_DELETE_NotceMessage_WITH_TYPE    \
@"DELETE  FROM " LT_TABLE_NoticeMessage @" "      \
@"WHERE "  LT_NoticeMessage_type @" = ? "

//查询指定消息类型未读的数量
#define LT_SQL_SELECT_NotceMessage_COUNT_WITH_TYPE  \
@"SELECT count(*) as " TOTALCOUNT  @" FROM " LT_TABLE_NoticeMessage @" "    \
@"WHERE "  LT_NoticeMessage_type @" = ? "


/*--------------------------- LTUserConfig 好友配置信息---------------------------**/
#define LT_TABLE_UserConfig             @"t_userConfig"

#define LT_UserConfig_id                      @"id"
#define LT_UserConfig_friendId                @"friendId"
#define LT_UserConfig_allowFriendSeeMyMoment  @"allowFriendSeeMyMoment"
#define LT_UserConfig_shieldFriendMoment      @"shieldFriendMoment"
#define LT_UserConfig_black                   @"black"
#define LT_UserConfig_notify                  @"notify"
#define LT_UserConfig_push                    @"push"
#define LT_UserConfig_top                     @"top"
#define LT_UserConfig_remark                  @"remark"
#define LT_UserConfig_chatBackground          @"chatBackground"

//创建表
#define LT_SQL_CREATE_UserConfig_TABLE          \
@"CREATE TABLE IF NOT EXISTS " LT_TABLE_UserConfig @" ("          \
LT_UserConfig_id                              @" TEXT, "          \
LT_UserConfig_friendId                        @" TEXT, "          \
LT_UserConfig_allowFriendSeeMyMoment          @" INTEGER, "       \
LT_UserConfig_shieldFriendMoment              @" INTEGER, "       \
LT_UserConfig_black                           @" INTEGER, "       \
LT_UserConfig_notify                          @" INTEGER, "       \
LT_UserConfig_push                            @" INTEGER, "       \
LT_UserConfig_top                             @" INTEGER, "       \
LT_UserConfig_remark                          @" TEXT, "          \
LT_UserConfig_chatBackground                  @" TEXT, "          \
@"PRIMARY KEY(" LT_UserConfig_friendId @")"                       \
@")"

//查询friendId的配置
#define LT_SQL_SELECT_UserConfig_WITHFriendId                    \
@"SELECT * FROM " LT_TABLE_UserConfig @" "                       \
@"WHERE " LT_UserConfig_friendId @" = ?"

//插入一条数据
#define LT_SQL_INSERT_UserConfig                         \
@"INSERT OR REPLACE INTO " LT_TABLE_UserConfig  @" ("    \
LT_UserConfig_id                            @" , "       \
LT_UserConfig_friendId                      @" , "       \
LT_UserConfig_allowFriendSeeMyMoment        @" , "       \
LT_UserConfig_shieldFriendMoment            @" , "       \
LT_UserConfig_black                         @" , "       \
LT_UserConfig_notify                        @" , "       \
LT_UserConfig_push                          @" , "       \
LT_UserConfig_top                           @" , "       \
LT_UserConfig_remark                        @" , "       \
LT_UserConfig_chatBackground                             \
@") VALUES (?,?,?,?,?,?,?,?,?,?)"


//删除指定FriendId的好友配置信息
#define LT_SQL_DELETE_UserConfig_FriendId          \
@"DELETE  FROM " LT_TABLE_UserConfig @" "         \
@"WHERE "  LT_UserConfig_friendId @" = ? "



/*--------------------------- LTGroupConfig 群组配置信息---------------------------**/
#define LT_TABLE_GroupConfig             @"t_groupConfig"

#define LT_GroupConfig_id                      @"id"
#define LT_GroupConfig_groupId                 @"groupId"
#define LT_GroupConfig_chatBackground          @"chatBackground"
#define LT_GroupConfig_myNameInGroup           @"myNameInGroup"
#define LT_GroupConfig_notify                  @"notify"
#define LT_GroupConfig_push                    @"push"
#define LT_GroupConfig_saveContacts            @"saveContacts"
#define LT_GroupConfig_showUserNickname        @"showUserNickname"
#define LT_GroupConfig_top                     @"top"



//创建LTGroupConfig表
#define LT_SQL_CREATE_GroupConfig_TABLE                                 \
@"CREATE TABLE IF NOT EXISTS " LT_TABLE_GroupConfig @" ("               \
LT_GroupConfig_id                                   @" TEXT, "          \
LT_GroupConfig_groupId                              @" TEXT, "          \
LT_GroupConfig_chatBackground                       @" TEXT, "          \
LT_GroupConfig_myNameInGroup                        @" TEXT, "          \
LT_GroupConfig_notify                               @" INTEGER, "       \
LT_GroupConfig_push                                 @" INTEGER, "       \
LT_GroupConfig_saveContacts                         @" INTEGER, "       \
LT_GroupConfig_showUserNickname                     @" INTEGER, "       \
LT_GroupConfig_top                                  @" INTEGER, "       \
@"PRIMARY KEY(" LT_GroupConfig_groupId @")"                             \
@")"

//通过groupId查询group的配置信息
#define LT_SQL_SELECT_GroupConfig_WITHGroupId                   \
@"SELECT * FROM " LT_TABLE_GroupConfig @" "                       \
@"WHERE " LT_GroupConfig_groupId @" = ?"

//插入一群组配置数据
#define LT_SQL_INSERT_GroupConfig    \
@"INSERT OR REPLACE INTO " LT_TABLE_GroupConfig @" ("   \
LT_GroupConfig_id                               @" , "       \
LT_GroupConfig_groupId                          @" , "       \
LT_GroupConfig_chatBackground                   @" , "       \
LT_GroupConfig_myNameInGroup                    @" , "       \
LT_GroupConfig_notify                           @" , "       \
LT_GroupConfig_push                             @" , "       \
LT_GroupConfig_saveContacts                     @" , "       \
LT_GroupConfig_showUserNickname                 @" , "       \
LT_GroupConfig_top                                          \
@") VALUES (?,?,?,?,?,?,?,?,?)"


//删除指定FriendId的好友配置信息
#define LT_SQL_DELETE_GroupConfig_GroupId          \
@"DELETE  FROM " LT_TABLE_GroupConfig @" "         \
@"WHERE "  LT_GroupConfig_groupId @" = ? "


#endif /* LTConversationCacheSQL_h */
